package m3d31;

import java.io.Serializable;

//进行序列化和反序列化的类必须实现这个接口，给这个类标记
public class pPerson implements Serializable {

    //显示声明序列号，序列化后改了类中的东西也可反序列化
    private static final long serialVersionUID = 124l;

    private String name;
    private int age;
    //这两个关键字修饰都是不能被序列化
    private static int i1;
    private transient int i2;

    public pPerson(String name, int age, int i2) {
        this.name = name;
        this.age = age;
        this.i2 = i2;
    }

    public pPerson() {
    }

    public pPerson(String name, int age) {
        this.name = name;
        this.age = age;
    }

    @Override
    public String toString() {
        return "pPerson{" +
                "name='" + name + '\'' +
                ", age=" + age +
                ", i2=" + i2 +
                '}';
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }
}
